<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
       "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
	   
<html>
  <head>

    <!-- metas -->
    <meta http-equiv="content-type" content="text/html;charset=UTF-8" />

    <title><%=h (yield(:title) || "MusicallyNoted") %></title>

    <!-- JS -->
    <%= javascript_include_tag 'application' %>
    <%= javascript_include_tag 'prototype' %>
    <%= javascript_include_tag 'effects' %>
    <%= javascript_include_tag 'scriptaculous.js?load=effects' %>
    <%= javascript_include_tag 'lightwindow' %>

    <!-- CSS -->
    <%= stylesheet_link_tag 'main', 'main-1', 'lightwindow' %>

    <!--[if !IE 7]>
      <style type="text/css">
        #wrap {display:table;height:100%}
      </style>
    <![endif]-->

  </head>

  <body>

    <div id="wrap">

      <div id="header">
        <div id="header-content">
          <div id="header-row-1">

            <div id="menu">

              <%= link_to 'Home', root_url %> |
              <%= link_to 'Random Article', random_article_path %> 
        
            </div><!-- /menu -->

            <div id="users">

              <% if current_user %>
                Welcome back, <%= link_to current_user.username, user_path(current_user) %> |
                <% if permitted_to? :show, :admins %>
                  <%= link_to "Admin", admin_path %> |
                <% end %>

                <% if permitted_to? :index, :delete_requests %>
                  <%= link_to "Requests", delete_requests_path %> |
                <% end %>

                <%= link_to "Logout", logout_path %>

              <% else %>

                <%= link_to "Register", new_user_path %> |
                <%= link_to "Login", login_path %> |
                <%= link_to "Forgot Password", reset_password_path %>

              <% end %>

            </div><!-- /users -->
          </div><!-- /header-row -->

          <div id="header-row-2">

            <div id="menu-title">
              Musically Noted
            </div><!-- /menu-title -->

            <div id="search-pane">

              <% form_tag(search_path, :method => "get") do %>
                <%= text_field_tag(:query) %>
                <%= submit_tag("Search", :name => nil) %>
              <% end %>

            </div><!-- /search-pane -->
          </div><!-- /header-row -->

        <div id="edit-controls">

        <% if !current_user %>
          See something wrong? Sign in and fix it!
        <% end %>

        <div id="controls">
        <% if current_user %>
          <%= yield(:edit) %> 
        <% end %>
        </div>

        </div><!-- /edit-controls -->
        </div><!-- /header-content -->
      </div><!-- /header -->

      <div id="main-content">

        <div id="flash">
          <%- flash.each do |name, msg| -%>
            <%= content_tag :div, msg, :id => "flash_#{name}" %>
          <%- end -%>
        </div><!-- /flash -->
 
        <%= yield %>
      </div><!-- /main-content -->

    </div><!-- /wrap -->

    <div id="footer">
      <div id="footer-content">
        Footer
      </div><!-- /footer-content -->
    </div><!-- /footer -->

  </body>

</html>
